<template>
	<!-- 常见问题 -->
	<view>
		<!-- #ifdef APP-PLUS -->
		<view class="status_bar"></view>  
		<!-- #endif -->
		<navbar title="常见问题"></navbar>
		<view class="line"></view>
		<view class="main">
			<view class="title">{{questionInfo.title}}</view>
			<view class="content">
				<rich-text :nodes="questionInfo.content"></rich-text>
			</view>
			<view class="tip">问题未解决？前往<text @click="toFeedback">提交反馈</text></view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id:'',
				questionInfo:{}
			}
		},
		onLoad(option) {
			this.id = option.id;
			this.getQuestiondetail();
		},
		methods: {
			//答疑详情
			getQuestiondetail(){
				this.$api.questiondetail({question_id:this.id}).then(res=>{
					this.questionInfo = res;
				})
			},
			toFeedback(){
				if(!uni.getStorageSync('token')){
					uni.showModal({
						title: '温馨提示',
						content: '登录后可继续操作，是否登录？',
						success: (res) => {
							if (res.confirm) {
								uni.navigateTo({
									url: '/pages/login/login'
								})
							}
						}
					})
				}else{
					uni.navigateTo({
						url:`./feedback?id=${this.id}`
					})
				}
			}
		}
	}
</script>

<style lang="scss">
page{
	padding-top: calc(var(--status-bar-height) + 115rpx);
	background-color: #FFFFFF;
}
.line{
	width: 750rpx;
	height: 15rpx;
	background-color: $page;
}
.main{
	padding: 40rpx;

	.title{
		font-size: 32rpx;
		font-family: Source Han Sans CN;
		font-weight: 600;
		color: #1B1B1B;
	}
	.content{
		font-size: 28rpx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		color: #535353;
		margin-top: 30rpx;
	}
	.tip{
		font-size: 28rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #0D0D0D;
		position: fixed;
		bottom: 60rpx;
		left: 50%;
		transform: translateX(-50%);
		
		text{
			color: #FF773B;
		}
	}
}
</style>
